﻿#include <iostream>

template<typename T, int cap>
class ArrayLink
{
public:
	struct u
	{
		T value;
		int next;
	};

	void Init()
	{
		size = 0;
		used = -1;
		free = 0;
		for (size_t i = 0; i < cap - 1; i++)
		{
			data[i].next = i + 1;
		}
		data[cap - 1].next = -1;
	}

	void Insert(T d)
	{

	}

	void Delete(T d)
	{
		int pos = Find(d);
		if (pos == -1)
		{
			return;
		}
		data[pos].next = free;
		free = pos;
	}

	int Find(T d)
	{
		int tmp = used;
		while (tmp != -1)
		{
			if (data[tmp].value == d)
			{
				return tmp;
			}
			tmp = data[tmp].next;
		}
		return -1;
	}

private:
	int size;
	u data[cap];
	int used;
	int free;
};

int main()
{
	return 0;
}
